<?php
declare (strict_types = 1);
namespace app\api\controller\season;

use app\LoginController;
use app\model\table\season\SeasonConfig;
use hg\apidoc\annotation as Apidoc;


/**
 * @Apidoc\Title("赛季")
 */
class SeasonController extends LoginController
{
    /**
     * @Apidoc\Title("赛季-列表")
     * @Apidoc\Method("GET")
     * @Apidoc\Returned("name", type="int", desc="赛季名称")
     * @Apidoc\Returned("stime", type="int", desc="赛季开始时间")
     * @Apidoc\Returned("etime", type="int", desc="赛季结束时间")
     */
    public function listAction()
    {
        $obj = SeasonConfig::instance()->tableList();
        $this->setData($obj);
        $this->sendJson();
    }

    /**
     * @Apidoc\Title("赛季-获取当前赛季")
     * @Apidoc\Method("GET")
     * @Apidoc\Returned("name", type="int", desc="赛季名称")
     * @Apidoc\Returned("stime", type="int", desc="赛季开始时间")
     * @Apidoc\Returned("etime", type="int", desc="赛季结束时间")
     */
    public function nowAction()
    {
        $SeasonObj = SeasonConfig::instance()->getNow();
        $this->setData($SeasonObj);
        $this->sendJson();
    }

}
